﻿@*@model IEnumerable<EzyGoEzySystem.Models.PaymentJournalEntry>*@
@model IEnumerable<object>
          
@{
    ViewBag.Title = "Index";
}

<h2>Summary</h2>

@if (((EzyGoEzySystem.Models.Account)HttpContext.Current.Session["Account"]) != null)
{
    EzyGoEzySystem.Models.Account account = (EzyGoEzySystem.Models.Account)HttpContext.Current.Session["Account"];
    
    <p>
        Username: @account.Username
    </p>
    
    <p>
        Full Name: @account.Name
    </p>
    
    <p>
        Balance: @account.Balance
    </p>


    <table>
        <tr>
            <th>
                Date
            </th>
            <th>
                Transaction
            </th>
            <th>
                Credit
            </th>
            <th>
                Debit
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            if (item is EzyGoEzySystem.Models.TravelJournalEntry)
            {
                var travelEntry = item as EzyGoEzySystem.Models.TravelJournalEntry;
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => travelEntry.AlightTime)
                    </td>
                    <td>
                        Type: Travel
                        <br />
                        @Html.DisplayFor(modelItem => travelEntry.TravelStatus)
                    </td>
                    <td>
                        NA
                    </td>
                    <td>
                         @Html.DisplayFor(modelItem => travelEntry.Fare)
                    </td>
            </tr>
            }
            else if (item is EzyGoEzySystem.Models.PaymentJournalEntry)
            {
                var paymentEntry = item as EzyGoEzySystem.Models.PaymentJournalEntry;
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => paymentEntry.PaymentDate)
                    </td>
                    <td>
                        Type: Payment
                        <br />
                        @Html.DisplayFor(modelItem => paymentEntry.PaymentStatus)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => paymentEntry.Amount)
                    </td>
                    <td>
                        NA
                    </td>
                </tr>
            }
        }

    </table>   
}
